May 85 Letters
Volume Number: 1
Issue Number: 6
Column Tag: Editorial, Letters, mousehole
Editorial, Letters 
Hot Air
David E. Smith
Welcome to the new “slick” look of MacTutor, The Macintosh Programming
Journal! This month we go big-time with 10,000 copies printed, most of which I hope
will get distributed to computer stores throughout Canada and the US. We now have a
new US distributor, Mac America, run by Jim Fitzsimmons, who happens to live about
three blocks from my house! Jim is distributing MacTutor, along with Macazine (the
mag, not the disk), and The Macintosh Buyer’s Guide. So when you step into your
favorite dealer, ask him if he’s got all three of Jim’s publications.
We appreciate the support our readers are giving to MacTutor’s advertisers.
Your support is important, because it is advertising that pays the bill for providing
high quality (and expensive) technical Macintosh programming information. Mega-
max has reported being very pleased with the response Mac- Tutor readers are giving
them.
We regret that Chris Derossi, the Chief Wizard, was unable to get a column in
this month due to pressing School assignments, but hope he will soon be with us with
more Pascal toolbox tutorials. Your letters encouraging him in his efforts I’m sure
will be appreciated.
MAC CAMP IS COMING! Come join us over the Labor Day weekend for Mac Camp at
the UCLA conference grounds. Should be great fun with a great technical Mac program.
Come learn a few new languages like Lisp! The camp can only handle 120 people, so get
your $250 deposit in now. First come, first serve. We want MacTutor readers to have
the first opportunity at Mac Camp before we advertise nationally.
Heinich “Benchmark” Revisited
In the February 1985 edition of MacTutor, we published this program sent in by
Mr. Robert Heinich of Boca Raton, FL:
main()
{
union u_storage{
long a_long;
struct T_0000{
short a_short;
short b_short;
}S_0000;
}storage;
storage.a_long = 6;
printf(“\na_short = %d”,
storage.S_0000.a_short);
printf(“\nb_short = %d”,
storage.S_0000.b_short);
printf(“\n”);
}
He was looking for the answers “a_short = 0” and “b_short = 6”. The nature of
this program compels me to make some comments.
The union maps 2 16-bit words over a 32-bit longword. The order of addressing
the two words in the longword is system-dependent.
The 68000 stores the least significant byte of a word at address n and the most
significant half at address n+1. Likewise, it stores the most significant half of a
longword at address n and the least significant half at address n+2 . It is this latter
property that the program uncovers.
Other machines (such as the DEC PDP-11 and VAX systems) store words and
bytes in the reverse order. There are sound reasons for each convention and I’ll not
argue either point.
What this program has brought up is the “discussion” of whether or not the C
language should hide such machine dependencies from the programmer.
Firstly, the current C languages do not hide machine dependencies. The new ANSI
standard does not call for machine independence either.
Some people feel that C is a high-level language and therefore a C program
written for machine X should run on any other machine (except for OS specific, of
course).
I couldn’t disagree more. C is a “system implementation” language. The whole
idea of C is to amplify the programmer’s productivity and enhance maintainability by
providing a viable alternative to assembly language.
If C compilers scrambled the addres- sing of struct members, it would make the
language nearly impossible to use for system programming. In fact, there are many
people who feel that automatic padding to insure correct alignment of structure
members is not good. The Mac C compiler has an option to control structure padding.
C provides a well-defined access to low-level machine specifics. I don’t want
that to change.
- Bob Denny
Board Member
More Mac Tech Stuff Please!
It’s a relief to find a serious and well-meant programmer’s forum. While the
thick and slick magazines are fun to look through, they’re not terribly nutritious.
Please resist the plaintive cries for tutorials! They’re understandable but would only
serve to water down the journal, which is geared toward Mac Tech stuff rather than
generic languages or applications (for example, Lisp-ing on the Mac will perhaps
spawn an AI applications journal).
-Ricky Evans
New York, NY.
How do you get dimmed text?
I program Mac with the Aztec C development system. Let me pose for you a puzzle
I’ve only half solved:
I wanted to display dimmed text. IM says that dimmed text is drawn with a gray
pen rather than a black one, so I wrote the code below:
PenPat(&gray);
DrawChar(‘D’);
Line(20,0);
The line was gray, but the “D” was black. Several tries later, I kluged gray
characters with the next five lines:
DrawChar(‘D’);
Line(20,0);
PenPat(&gray);
PenMode(patBic);
PaintRect(&screenBits.bounds);
These mysteries remain: Why don’t the first three lines work? What is the
“right” way to draw dimmed text?
-David Levner
Rego Park, NY
Pascal Turtle Program
I want to program my Macintosh and you guys seem to be the only hacker
magazine around...I’m grateful. Some questions: Which C language do you use? Where
can I get the famous Apple Assembler? In MacPascal, how does one use the sound driver
procedures? Everytime I try to use them I get a short blip and “Sorry, out of
memory”. Help! I tried to make a simple crash noise using the free form driver and
nothing seemed to happen. How do I do it? Here’s a little Pascal Turtle Program I
wrote:
program TURTLE;
{The turtlegraphics interface}
{by David Ezekiel}
const
twopi = 6.283185307;
cf=0.017453292
var
tx,ty:integer;
ta: real;
i:integer;
Procedure comp;
begin
while ta<0 do
ta:=ta+twopi;
while ta>=twopi do
ta:=ta-twopi;
end;
Procedure turn(an:integer);
begin
ta:=ta+cf*an;
comp;
end;
Procedure turnto(an:integer);
begin
ta:=cf*(an+90);
comp;
end;
Procedure move(dist:integer);
var
dx,dy:integer;
begin
dx:=round(dist*sin(ta));
dy:=round(dist*cos(ta));
tx:=tx+dx;
ty:=ty+dy;
lineto(tx,ty);
end;
Procedure turt(x,y:integer);
begin
tx:=x;
ty:=y;
moveto(tx,ty);
turnto(0);
end;
Procedure spiral;
var
i:integer;
begin
for i:=1 to 20 do
begin
turn(400-i);